<?php

class Cms_Form_User extends Zend_Form
{

    public function init()
    {
        $this->setMethod('post');
        
        // Create id element
        $id = $this->createElement('hidden', 'userId');
        // Set Options
        $id->setDecorators(array('ViewHelper'));
        // Add the element to the form
        $this->addElement($id);
        //**********************************************************************
                
        // Create nome element
        $nome = $this->createElement('text', 'userNome');
        // Set Options
        $nome->setLabel('Nome:');
        $nome->setRequired(TRUE);
        $nome->addFilter('StripTags');
        // Add the element to the form
        $this->addElement($nome);
        //**********************************************************************
        
        // Create email element
        $email = $this->createElement('text', 'userEmail');
        // Set Options
        $email->setLabel('Email:');
        $email->setRequired(TRUE);
        $email->addValidator('EmailAddress');
        $email->addErrorMessage('Inserisci un indirizzo email valido, per favore.');
        // Add the element to the form
        $this->addElement($email);
        //**********************************************************************

//        // Create role element
//        $role = $this->createElement('select', 'userRole');
//        // Set Options
//        $role->setLabel('Seleziona un ruolo:');
//        $role->addMultiOptions(array(
//            'user'  => 'user',
//            'admin' => 'admin',
//        ));
//        // Add the element to the form
//        $this->addElement($role);
        //**********************************************************************
        
        // Create password element
        $pwd = $this->createElement('password', 'userPassword');
        // Set Options
        $pwd->setLabel('Password: ');
        $pwd->setRequired(TRUE);
        // Add the element to the form
        $this->addElement($pwd);
        //**********************************************************************
        
//        //Configure the CAPTCHA service
//        // Ricorda di cambiare il dominio per il sito in produzione
//        $privateKey = '6LfJgdMSAAAAAO1nfSnJbGwJp83hKXQlUqHa43lJ';
//        $publicKey = '6LfJgdMSAAAAAJNpAO65ZOavslXPf4AI9IcRr1Ji';
//        $recaptcha = new Zend_Service_ReCaptcha($publicKey, $privateKey);
//        
//        //Create CAPTCHA control
//        $captcha = new Zend_Form_Element_Captcha('captcha', array(
//            'captcha' => 'ReCaptcha',
//            'captchaOptions' => array('captcha' => 'ReCaptcha',
//                                      'service' => $recaptcha,
//                                      'lang' =>'it',
//                )
//        ));
//        $captcha->addDecorators(array(
//            array('Errors', array(
//                                'class' =>'error list-style-type-none'
//            ))
//        ));
//        
//        // Add captha to the form
//        $this->addElement($captcha);
        
        //**********************************************************************
        
        //Submit button
        $this->addElement('submit', 'submit',
                array('label' => 'Registrati!'));
        
        //**********************************************************************
    }


}

